import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;


public class HockeyDriver {


	public static void main(String[] args) {
		HockeyPlayer kesler = new HockeyPlayer("Ryan", "Kesler");
		
		kesler.addGoal();
		kesler.addAssist();
		
		HockeyPlayer daniel = new HockeyPlayer("Daniel", "Sedin");
		daniel.addAssist();
		
		HockeyPlayer henrick = new HockeyPlayer("Henrick", "Sedin");
		henrick.addAssist();
		henrick.addAssist();
		henrick.addAssist();
		
		List<HockeyPlayer> canucks = new ArrayList<HockeyPlayer>();
		
		canucks.add(kesler);
		canucks.add(daniel);
		canucks.add(henrick);
		
		kesler = null;
		daniel = null;
		henrick = null;
		
		for(HockeyPlayer who : canucks) {
			System.out.println(who.getFirstName() + " " + who.getTotalPoints());
		}
		
		HockeyPlayer childSlave = new HockeyPlayer("Daniel", "Sedin");
		int foundPosition = canucks.indexOf(childSlave);
		HockeyPlayer foundPlayer = canucks.get(foundPosition);
		
		String teamName = "Canucks";
		String teamAddress = "sdfsdf West Georgia";
		
		foundPlayer.addGoal();
		foundPlayer.addGoal();

		Collections.sort(canucks);
//		Collections.reverse(canucks);

		System.out.println("After update");
		
		for(HockeyPlayer who : canucks) {
			System.out.println(who.getLastName() +  " " + who.getFirstName() + " " + who.getTotalPoints());
		}
		
		System.out.println("Iterator version");
		
		Iterator<HockeyPlayer> secretary = canucks.iterator();
		
		while(secretary.hasNext()) {
			HockeyPlayer aPlayer = secretary.next();
			System.out.println(aPlayer.getFirstName());
		}
	}

}
